home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Utilities / DOpus / opusmpega / modules / OpusMPEGA.dopus5 < prev   
Encoding:
Text File  |  1998-03-28  |  21.5 KB  |  662 lines

  1. /*
  2. ** AREXX Modul for a DOpus GUI MPEG-Soundplaying Layer 1, 2 & 3
  3. ** Displays Songname, MPEG-Quality, Playtime in a Dopus Progress Window.
  4. **
  5. ** Needed: Directory Opus V5.5+ (© by Jonathan Potter & GPSoftware)
  6. **         mpega >= V3.1 (© 1995-97 by Stephane Tavenard)
  7. **
  8. ** Optional:
  9. **       Melody MPEG-Soundcard (© 1997 KATO)
  10. **       MPEGPlay by Thorsten Hansen V1.0+
  11. **         PeggyPlus MPEG-Card (© Ingenierbuero Helfrich)
  12. **        Toccata, Prelude, Delfina-Soundcard & other Soundcard with AHI-Driver
  13. **       AHI Retargetable Audio System (© by Martin Blom)
  14. **
  15. ** 
  16. ** $VER: OpusMPEGA.dopus5 3.0 (20.3.98) ©1995-1998 by Eckhard Ludwig (Eckhard@top.east.de) [Emailware]
  17. **
  18. ** This program is Email-Ware !
  19. **
  20. ** Installation:
  21. ** Copy to DOpus5:Modules
  22. ** Install the Filetypes (ID = MP2 for Layer-2, ID = MP3 for Layer-3)!
  23. **
  24. ** Usage:
  25. ** Select mpegaudio files and click the Play Button
  26. ** If you want to skip a sound a file press the abort button.
  27. ** To abort the complete Player abort two soundplayings in the first 5 secs.
  28. ** more functions in the Appicon Menu
  29. ** Für deutsche Texte OpusMPEGA.catalog installieren.
  30. */
  31.  
  32. Player = "MPEGA"            /* alternative: MELODY PEGGYPLAYER PEGGYMELODY CD32 */
  33. PlayMPEG = "C:MPEGA.040"           /* Path Softwareplayer Layer-3 */
  34. PlayMelody = "C:MPEGPlay"         /* Path Melody Hardwareplayer */
  35. MPEGA_OPTIONS="-p0 -T -f0 -d2 -q2"      /* MPEGA Optionen, Default Amiga Paula */
  36. BREAKMPEG = "C:BreakName"         /* Path MPEGA Breaktool */
  37. MP3INF="C:MP3INFO"
  38. HELPPATH="DOpus5:Help/OpusMPEGA.guide"
  39. SETUPPATH="SYS:Prefs/OpusMPEGA"
  40.  
  41. signal on syntax
  42. options failat 21
  43. options results
  44. LF='0a'x
  45.  
  46. parse arg portname function oldsource dest arguments
  47.  
  48. address value portname
  49. dopus version
  50. if (result='RESULT' | TRANSLATE(result,'.',' ') < 5.1218) then do
  51.             dopus request '"This module (OpusMPEGA.dopus5)"'LF'"requires DOpus V5.5 or greater." Exit'
  52.             exit
  53.     end
  54.  
  55. if ~show('l','rexxsupport.library') then call addlib('rexxsupport.library',0,-30,0)
  56. if ~show('l','rexxsupport.library') then do
  57.             dopus request '"Error ... (OpusMPEGA.dopus5)"'LF'"Couldnt open rexxsupport.library!?" Exit'
  58.             exit
  59.     end
  60.  
  61. if ~show(l,'locale.library') then call addlib('locale.library',0,-30)
  62. if show(l,'locale.library') then catalog=opencatalog('OpusMPEGA.catalog','english',0)
  63.  
  64. if open(1,'Env:OpusMPEGA.prefs','R') then do
  65.        do i=1 to 14
  66.         prefs.i = readln(1)
  67.        end
  68.        if prefs.2 ~="" then PlayMelody=prefs.2
  69.        if prefs.3 ~="" then PlayMPEG=prefs.3
  70.        if prefs.4 ~="" then BREAKMPEG=prefs.4
  71.        if prefs.5 ~="" then MPEGA_OPTIONS=prefs.5
  72.        if prefs.6 ~="" then Player=prefs.6
  73.        if prefs.12 ~="" then HELPPATH=prefs.12
  74.        if prefs.13 ~="" then SETUPPATH=prefs.13
  75.        if prefs.14 ~="" then MP3INF=prefs.14
  76.        call close(1)
  77.    end
  78.  
  79. if function='init' then do
  80.         dopus command "OpusMPEGA" program "OpusMPEGA" desc '"'getcatstr(3,'Play Selected Sounds')'"' source
  81.         if prefs.7~='PLAYOFF' then dopus command "Play" program "OpusMPEGA" desc '"'getcatstr(3,'Play Selected Sounds')'"' source
  82.     if prefs.8='ICONOFF' then exit
  83.     end
  84.     else if function~='Play'&function~='OpusMPEGA' then exit
  85.  
  86. if ~openport('mpegport') then do
  87.     dopus send 'mpegport' 'ADD 'oldsource
  88.     exit
  89.     end
  90.  
  91. mpmenu.count=14
  92. mpmenu.0=getcatstr(14,'Open File(s)')
  93. mpmenu.1='TAG Info'
  94. mpmenu.2=getcatstr(20,'Help')
  95. mpmenu.3=getcatstr(13,'Preferences')
  96. mpmenu.4="---"
  97. mpmenu.5=getcatstr(18,'Previous')
  98. mpmenu.6=getcatstr(19,'Play')
  99. mpmenu.7=getcatstr(21,'Stop')
  100. mpmenu.8=getcatstr(22,'Next')
  101. mpmenu.9="---"
  102. mpmenu.10=getcatstr(15,'Hide')
  103. mpmenu.11=getcatstr(16,'Show')
  104. mpmenu.12="---"
  105. mpmenu.13=getcatstr(1,'Beenden')
  106.  
  107. dopus addappicon 'mpegport' '"Opus MPEGA"' 100 icon "DOpus5:Icons/OpusMPEGAAppIcon" info quotes close menu mpmenu
  108. apphandle=result
  109.  
  110. if exists(prefs.11) then LOADPATH='"'prefs.11'"'
  111.     else LOADPATH="RAM:"
  112.  
  113. if function~='init' & ~exists(PlayMPEG) then do
  114.          ADDRESS VALUE portname
  115.            dopus request '"'getcatstr(9,'Fatal Error ...'LF''LF'MPEGA by Stéphane TAVENARD not found?!'LF'path to command: '"'%s'"'',PlayMPEG)'"' getcatstr(17,'OK|Preferences|Help')
  116.     if RC=0 then command run HELPPATH
  117.     else if RC=2 then command run SETUPPATH
  118.          exit
  119.     end
  120.  
  121. if function~='init' & ~exists(BREAKMPEG) then do
  122.          ADDRESS VALUE portname
  123.            dopus request '"'getcatstr(10,'Error ...'LF''LF'Breaktool by Kai Iske not found?!'LF'path to command: '"'%s'"'',BREAKMPEG)'"' getcatstr(17,'OK|Preferences|Help')
  124.     if RC=0 then command run HELPPATH
  125.     else if RC=2 then command run SETUPPATH
  126.     end
  127.  
  128. k=0
  129. j=0
  130. lister query oldsource selentries
  131. DATA=result
  132. if READALL()=5 then do
  133.     dopus remappicon apphandle
  134.     call closeport('mpegport')
  135.     exit
  136.   end
  137.  
  138. /*-------Schleife mpegport----------------------------------------------------------------------------*/
  139.  
  140. do forever
  141.     STOP=0
  142.     Arg1=0
  143.     if k=0 then do
  144.         call waitpkt('mpegport')
  145.     packet=getpkt('mpegport')
  146.     if packet='00000000'x then iterate
  147.     call MESSAGE
  148.     if k=0 then iterate
  149.     end
  150.     address command BREAKMPEG" "PlayMPEG" C"
  151.     If Show("P","DELITRACKER") then  address 'DELITRACKER' 'QUIT'
  152.     If Show("P","RXTRACKER") then  address 'RXTRACKER' 'QUIT'
  153.     DUMMY=delay(20)
  154.     address value portname
  155.     lister new toolbar DUMMY
  156.     handle=result
  157.     lister set handle title 'Opus MPEGA'
  158.     lister set handle label 'Opus MPEGA'
  159.     lister set handle header 'MPx Audioplayer V3.0, ©1998 by Eckhard@top.east.de'
  160.     lister set handle namelength 100
  161.     lister set handle sort name
  162.     select
  163.         when prefs.9='SIZEON' & prefs.10='COMMENTON' then lister set handle display comment size name
  164.         when prefs.9='SIZEON' then lister set handle display comment size
  165.         when prefs.10='COMMENTON' then lister set handle display comment name
  166.         otherwise lister set handle display comment
  167.     end
  168.     lister set handle busy on
  169.     call ADDFILES(0)
  170.     lister set handle newprogress name info bar abort
  171.     lister refresh handle full
  172.  
  173.     do until j=k
  174.     do while STOP=1
  175.         If waitpkt('mpegport') then do
  176.                    packet=getpkt('mpegport')
  177.                    if packet='00000000'x then iterate
  178.             call MESSAGE
  179.             select
  180.                 when result=13|Arg1="EXIT" then STOP=1
  181.                 when result=8|Arg1="NEXT" then do
  182.                        lister select handle '"'right(j+1,3," ")'.'substr(SONG.j,pos("@COMMENT=",SONG.j)+9)'"' off
  183.                        lister refresh handle
  184.                     j=Min(j+1,k-1)
  185.                     end
  186.                 when result=5|Arg1="PREVIOUS" then j=Max(j,1)-1
  187.                 when result=6|Arg1="PLAY"|result=20 then j=j
  188.                 otherwise iterate
  189.               end
  190.             lister set handle newprogress name info bar abort
  191.             STOP=0
  192.         end
  193.       end
  194.     if (Arg1="menu"&Arg3=13)|Arg1="EXIT" then leave
  195.        Titel=left(SONG.j,pos("@SIZE",SONG.j)-2)
  196.        if ~exists(Titel) then iterate
  197.     ADDRESS VALUE portname
  198.        dopus getfiletype '"'Titel'"' id
  199.     DT=result
  200.        APOS=lastpos("/",Titel)
  201.        if APOS=0 then APOS=lastpos(":",Titel)   
  202.        songname=substr(Titel,APOS+1)
  203.      SEC=0
  204.     NOABORT=0
  205.        lister select handle '"'right(j+1,3," ")'.'substr(SONG.j,pos("@COMMENT=",SONG.j)+9)'"' on
  206.        lister refresh handle
  207.     If DT="MP3"|Player="MPEGA" then do
  208.         if Player="PEGGYPLAYER" & show('P','Peggy') then address 'Peggy' QUIT
  209.         If (Player="MELODY"|Player="PEGGYMELODY"|Player="CD32") & show('P','MPEGPLAY.1') then address 'MPEGPLAY.1' 'QUIT'
  210.             address command "RUN >NIL: "PlayMPEG" <nil: "MPEGA_OPTIONS" " '"'Titel'"' " >PIPE:MPEGA"
  211.             if ~Open('MPEGAOUT','PIPE:MPEGA','r') then do
  212.             address command BREAKMPEG" "PlayMPEG" C"
  213.             ADDRESS VALUE portname
  214.                      dopus front
  215.                      lister request handle '"'getcatstr(7,'System Error ...'LF'DEVS:DOSDrivers/PIPE not installed?!')'"' getcatstr(1,'Quit')
  216.             leave
  217.              end
  218.            MPEGAV = readln('MPEGAOUT')
  219.         if  substr(MPEGAV,11,3)>=3.3 then MPEGAV=substr(MPEGAV,5,9)||substr(MPEGAV,19)
  220.           else VMPEGA=1
  221.             parse var MPEGAV MPEGAV "(C)"
  222.         do until readln('MPEGAOUT')=""
  223.         end
  224.            BUFFER=""
  225.            DUMMY=""
  226.            do until DUMMY='0D'x
  227.             DUMMY=readch('MPEGAOUT',1)
  228.                  BUFFER=BUFFER||DUMMY
  229.               end
  230.         if VMPEGA=1 then do
  231.             PM=substr(BUFFER,1,2)
  232.             PS=substr(BUFFER,4,2)
  233.             CD=substr(BUFFER,7,pos('0A'x,BUFFER)-7)
  234.           end
  235.           else do
  236.             PM=substr(BUFFER,pos('length:',BUFFER)+12,2)
  237.             PS=substr(BUFFER,pos('length:',BUFFER)+15,2)
  238.             CD=substr(BUFFER,pos('Type:',BUFFER)+10)
  239.             CD=left(CD,pos('1B'x,CD)-1)
  240.           end
  241.             TIME=PM*60+PS
  242.            adress value portname
  243.             lister set handle newprogress title MPEGAV
  244.             do until Eof('MPEGAOUT')
  245.             do until readch('MPEGAOUT',1)='0D'x|Eof('MPEGAOUT')
  246.                end
  247.             if PM>=0 then do
  248.                    lister set handle newprogress bar TIME SEC
  249.                       lister set handle newprogress info PM":"PS"  "songname
  250.                 if SEC<4 then lister set handle newprogress name left(getcatstr(12,'For Quit press now Abort:')' Countdown '4-SEC,40)' 'j+1' of 'k
  251.                         else lister set handle newprogress name left(CD,37)' 'j+1' of 'k
  252.               end
  253.             SEC=SEC+1
  254.             PS=right(PS-1,2,0)
  255.             if PS<0 then do
  256.                 PS=59
  257.                 PM=right(PM-1,2,0)
  258.               end
  259.               lister query handle abort
  260.               if result then leave
  261.                 packet=getpkt('mpegport')
  262.                 if packet~='00000000'x then do
  263.                 call MESSAGE
  264.                 if result=7|Arg1="STOP" then do
  265.                     address command BREAKMPEG" "PlayMPEG" C"
  266.                         CALL Close('MPEGAOUT')
  267.                     j=j-1
  268.                     STOP=1
  269.                     address value portname
  270.                     lister clear handle progress
  271.                     leave
  272.                     end
  273.                 if result=8|Arg1="NEXT" then leave
  274.                 if result=5|Arg1="PREVIOUS" then do
  275.                     j=Max(j,1)-2
  276.                     leave
  277.                     end
  278.                     end
  279.                 if result=13|Arg1="EXIT" then leave
  280.               end
  281.         address command BREAKMPEG" "PlayMPEG" C"
  282.             call close('MPEGAOUT')
  283.            if TIME>5 & SEC<6 & NOABORT=0 then leave
  284.       end
  285.     if DT="MP2"&(Player="MELODY"|Player="PEGGYMELODY"|Player="CD32") then do
  286.         if Player="MELODY" & exists(PlayMelody) & ~show('P','MPEGPLAY.1') then do
  287.             call pragma('STACK',10000)
  288.                     address command
  289.                     'run >NIL: <NIL: 'PlayMelody' DEV=melodympeg.device BUFF=32000 NBUFF=10 PUBSCREEN='portname
  290.                     'waitforport MPEGPLAY.1'
  291.               address 'MPEGPLAY.1' 'hidegui'
  292.             end
  293.         if Player="PEGGYMELODY" & exists(PlayMelody) & ~show('P','MPEGPLAY.1') then do
  294.             call pragma('STACK',10000)
  295.             address command
  296.             'run >NIL: <NIL: 'PlayMelody' DEV=peggympeg.device BUFF=5000 NBUFF=20 PUBSCREEN='portname
  297.             'waitforport MPEGPLAY.1'
  298.               address 'MPEGPLAY.1' 'hidegui'
  299.             end
  300.         if Player="CD32" & exists(PlayMelody) & ~show('P','MPEGPLAY.1') then do
  301.             call pragma('STACK',10000)
  302.             address command
  303.             'run >NIL: <NIL: 'PlayMelody' DEV=mpeg.device BUFF=32000 NBUFF=10 PUBSCREEN='portname
  304.             'waitforport MPEGPLAY.1'
  305.               address 'MPEGPLAY.1' 'hidegui'
  306.             end
  307.         address value portname
  308.            lister set handle newprogress title "MPEGPlay ©1997 by Thorsten Hansen"
  309.         if ~show('P','MPEGPLAY.1') then do
  310.                 dopus front
  311.                 lister request handle '"'getcatstr(11,'Fatal Error ...'LF''LF'MPEGPlay by Thorsten Hansen not found?!'LF'Path to Command: '"'%s'"''LF'For Setup select Player-Setup !',PlayMelody)'"' getcatstr(1,'Quit')
  312.             leave
  313.             end
  314.           address 'MPEGPLAY.1' 'play' Titel
  315.         PM="00"
  316.         PS="00"
  317.         do forever
  318.                address value portname
  319.                lister set handle newprogress bar k j+1
  320.                   lister set handle newprogress info PM":"PS"  "songname
  321.             if SEC<4 then lister set handle newprogress name left(getcatstr(12,'For Quit press now Abort:')' Countdown '4-SEC,40)' 'j+1' of 'k
  322.                    else lister set handle newprogress name j+1' of 'k
  323.             DUMMY=Delay(48)
  324.                   address 'MPEGPLAY.1' 'playstate'
  325.             if result=1 then leave
  326.             SEC=SEC+1
  327.             PS=right(PS+1,2,0)
  328.             if PS=60 then do
  329.                 PS="00"
  330.                 PM=right(PM+1,2,0)
  331.                 end
  332.                 packet=getpkt('mpegport')
  333.                 if packet~='00000000'x then do
  334.                 call MESSAGE
  335.                 if result=7|Arg1="STOP" then do
  336.                           address 'MPEGPLAY.1' 'stop'
  337.                     j=j-1
  338.                     STOP=1
  339.                     address value portname
  340.                     lister clear handle progress
  341.                     leave
  342.                     end
  343.                 if result=8|Arg1="NEXT" then leave
  344.                 if result=5|Arg1="PREVIOUS" then do
  345.                     j=Max(j,1)-2
  346.                     leave
  347.                     end
  348.                     end
  349.                 if result=13|Arg1="EXIT" then leave
  350.               lister query handle abort
  351.               if result then leave
  352.         end
  353.               address 'MPEGPLAY.1' 'stop'
  354.            if SEC<5 & NOABORT=0 then leave
  355.       end
  356.     if DT="MP2"&Player="PEGGYPLAYER" then do
  357.            if showlist("A","PEGGYPLUS")=1 & ~show('P','Peggy') then do
  358.             call pragma('STACK',8192)
  359.                 address command
  360.                     'run >NIL: <NIL: PEGGYPLUS:MPEGPlayer'
  361.                 'waitforport Peggy'
  362.             DUMMY=Delay(10)
  363.            end
  364.         address value portname
  365.         lister set handle newprogress bar k j+1
  366.            lister set handle newprogress title "PEGGY plus  MPEG-Player"
  367.         lister set handle newprogress info songname
  368.         lister set handle newprogress name j+1' of 'k
  369.             if ~show('P','Peggy') then do
  370.                 dopus front
  371.                 lister request handle '"'getcatstr(8,'Fatal Error ...'LF''LF'Peggy-Plus MPEG Player not found !'LF'Please run Peggy-Player first.')'"' getcatstr(1,'Quit')
  372.             leave
  373.                    end    
  374.               address 'Peggy'
  375.               open '"'Titel'"'
  376.         if PEGGYFIRST~=1 then do
  377.                   setwindow XOFF 0 YOFF 0 WIDTH 1 HEIGHT 1 XPIC 0 YPIC 0
  378.             PEGGYFIRST=1
  379.                   Play
  380.             end
  381.             else do
  382.             Play async
  383.             Play wait
  384.             end
  385.            address value portname
  386.           lister query handle abort
  387.           if result then leave
  388.         packet=getpkt('mpegport')
  389.         if packet~='00000000'x then do
  390.             call MESSAGE
  391.             if result=13|Arg1="EXIT" then leave
  392.             end
  393.       end
  394.        address value portname
  395.     lister clear handle abort
  396.        lister select handle '"'right(j+1,3," ")'.'substr(SONG.j,pos("@COMMENT=",SONG.j)+9)'"' off
  397.        lister refresh handle
  398.         j=j+1
  399.         if (Arg1="menu"&Arg3=13)|Arg1="EXIT" then leave
  400.     end
  401.     lister set handle busy off
  402.     lister close handle
  403.     PEGGYFIRST=0
  404.     j=0
  405.     k=0
  406.     if Player="PEGGYPLAYER" & show('P','Peggy') then address 'Peggy' QUIT
  407.     If (Player="MELODY"|Player="PEGGYMELODY"|Player="CD32") & show('P','MPEGPLAY.1') then address 'MPEGPLAY.1' 'QUIT'
  408. end
  409.  
  410. /*-------QUIT----------------------------------------------------------------------------*/
  411. Ende:
  412. address value portname
  413. lister clear handle progress
  414. lister set handle busy off
  415. lister close handle
  416.  
  417. dopus remappicon apphandle
  418. call closeport('mpegport')
  419. if Arg1="EXIT" then exit
  420. if Player="PEGGYPLAYER" & show('P','Peggy') then address 'Peggy' QUIT
  421. If show('P','MPEGPLAY.1') then address 'MPEGPLAY.1' 'QUIT'
  422. exit
  423.  
  424. /*------- Message from mpegport----------------------------------------------------------*/
  425. MESSAGE:
  426. Arg1=getarg(packet,0)
  427. Arg2=getarg(packet,1)
  428. Arg3=getarg(packet,2)
  429. Arg4=getarg(packet,3)
  430. reply(packet,10)
  431. NOABORT=1
  432. if word(Arg1,1)='ADDSONG'|word(Arg1,1)='PLAYSONG' then do
  433.     pos1=pos('"',Arg1)+1
  434.     addname=substr(Arg1,pos1,pos('"',Arg1,pos1+1)-pos1)
  435.     dopus getfiletype '"'addname'"' id
  436.     if result="MP2"|result="MP3" then do
  437.         if word(Arg1,1)='PLAYSONG' then do
  438.                 lister close handle
  439.                 PEGGYFIRST=0
  440.                 j=0
  441.                 k=0
  442.             lister clear handle
  443.             lister clear handle abort
  444.         end
  445.         /*lister query playhandle entry '"'addname'"' stem fileinfo.*/
  446.         fileinfo.size=0
  447.         fileinfo.comment=""
  448.         SONG.k=addname' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment
  449.         lister add handle '"'right(k+1,3," ")'.'fileinfo.comment'" 'fileinfo.size' -1 'k' r 'addname''
  450.            lister select handle '"'right(k+1,3," ")'.'fileinfo.comment'"' on
  451.         lister refresh handle
  452.         k=k+1
  453.        end
  454.     return 20
  455.     end
  456. if word(Arg1,1)="ADD" then do
  457.     oldsource=word(Arg1,2)
  458.     lister query oldsource selentries
  459.     DATA=result
  460.     l=k
  461.     call READALL()
  462.     call ADDFILES(l)
  463.     return
  464.     end
  465. if (Arg1="menu"&Arg3=13)|Arg1="close"|Arg1="QUIT"|Arg1="EXIT"|Arg1="STOP" then do 
  466.     if DT="MP3"|Player="MPEGA" then do
  467.         address command BREAKMPEG" "PlayMPEG" C"
  468.             call close('MPEGAOUT')
  469.         end
  470.     if show('P','MPEGPLAY.1')&DT="MP2"&(Player="MELODY"|Player="PEGGYMELODY"|Player="CD32") then address 'MPEGPLAY.1' 'stop'
  471.     if Arg1="close"|Arg1="QUIT" then call Ende
  472.     return Arg3
  473.     end
  474. if Arg2~=100 then return
  475. if Arg1="info"|Arg1="doubleclick" then do
  476.     dopus request '"'getcatstr(23,'Opus MPEGA'LF'The Definitive MPEG Audio Player for Directory Opus'LF''LF'©1995-1998 by Eckhard Ludwig [Emailware]'LF'Plays MPEG Audio Layer-2&3 and Wave MPs'LF''LF'Greets... Stéphane Tavenard (mpega)'LF'Martin Blom (AHI) Thomas Wenzel (Play16)...')'"' getcatstr(17,'OK|Preferences|Help')
  477.     if RC=0 then command run HELPPATH
  478.     else if RC=2 then command run SETUPPATH
  479.     end
  480. if Arg1="menu" then do
  481.     if Arg3=0 then do
  482.             address command 'requestfile DRAWER 'LOADPATH' PATTERN #?.MP? TITLE "'getcatstr(24,'Select MPx Audiofile(s)...')'" MULTISELECT NOICONS >PIPE:MPDATA'
  483.             if RC>0 then return
  484.              if ~Open('MP','PIPE:MPDATA','r') then return
  485.             DATA = readln('MP')
  486.             call close('MP')
  487.         pos1=2
  488.         do forever
  489.             pos2=pos('"',DATA,pos1+1)
  490.             if pos2=0 then leave
  491.                addname=substr(DATA,pos1,pos2-pos1)
  492.             pos1=pos2+3
  493.             dopus getfiletype '"'addname'"' id
  494.             if result="MP2"|result="MP3" then do
  495.                 pos3=lastpos("/",addname)
  496.                 if pos3=0 then pos3=pos(":",addname)
  497.                 LOADPATH=left(addname,pos3)
  498.                 SONG.k=addname' @SIZE=0 @COMMENT='addname
  499.                    lister add handle '"'right(k+1,3," ")'.'addname'" 1 -1 'k' r 'substr(addname,pos3+1)''
  500.                    lister select handle '"'right(k+1,3," ")'.'addname'"' on
  501.                 lister refresh handle
  502.                 k=k+1
  503.                 end
  504.         end
  505.         return
  506.       end
  507.     if Arg3=1 then do
  508.         if exists(MP3INF) then address command MP3INF' -f' '"%a-%t%N%l %y%N%c%N%V Layer-%A%N%bkbps %FHz %M%N%mm:%ss%N%i Bytes "' '"'Titel'"' ' >PIPE:MP3INFO'
  509.         else address command PlayMPEG" -h -s " '"'Titel'"' " >PIPE:MP3INFO"
  510.              if ~Open('MP','PIPE:MP3INFO','r') then return
  511.         DATA=Titel||LF
  512.             do until Eof('MP')
  513.                  DATA=DATA||readch('MP',1)
  514.               end
  515.             call close('MP')
  516.         lister request handle '"'DATA'"'
  517.         end
  518.     if Arg3=2 then command run HELPPATH
  519.     if Arg3=3 then command run SETUPPATH
  520.     if Arg3=10 then lister iconify handle
  521.     if Arg3=11 then lister iconify handle off
  522.     end
  523. if Arg1="dropfrom" then do
  524.     dropsource=Arg4
  525.     lister query dropsource path
  526.     droppfad=result
  527.     pos1=2
  528.     do forever
  529.         pos2=pos('"',Arg3,pos1+1)
  530.         if pos2=0 then leave
  531.            addname=substr(Arg3,pos1,pos2-pos1)
  532.         pos1=pos2+3
  533.         lister query dropsource entry '"'addname'"' stem fileinfo.
  534.         if fileinfo.type >0 then do
  535.             l=k
  536.             lister new toolbar DUMMY droppfad||fileinfo.name
  537.             source=result
  538.             lister wait source
  539.             if READSOURCE(1)=5 then return
  540.             call ADDFILES(l)
  541.             end
  542.             else do
  543.             dopus getfiletype '"'droppfad||addname'"' id
  544.             if result="MP2"|result="MP3" then do
  545.                 lister query dropsource entry '"'addname'"' stem fileinfo.
  546.                 SONG.k=droppfad||addname' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment
  547.                    lister add handle '"'right(k+1,3," ")'.'fileinfo.comment'" 'fileinfo.size' -1 'k' r 'addname''
  548.                    lister select handle '"'right(k+1,3," ")'.'fileinfo.comment'"' on
  549.                 lister refresh handle
  550.                 k=k+1
  551.                 end
  552.         end
  553.         end
  554.     end
  555. return Arg3
  556.  
  557. /*---------Files in Playlister eintragen----------------------------------------------------------------------*/
  558. ADDFILES:
  559. parse arg Arg1
  560. address value portname
  561. do i=Arg1 to k-1
  562.     SPOS=pos("@SIZE=",SONG.i)
  563.        CPOS=pos("@COMMENT=",SONG.i)
  564.     Titel=left(SONG.i,SPOS-2)
  565.        APOS=lastpos("/",Titel)
  566.        if APOS=0 then APOS=lastpos(":",Titel)   
  567.        lister add handle '"'right(i+1,3," ")'.'substr(SONG.i,CPOS+9)'" 'substr(SONG.i,SPOS+6,CPOS-SPOS-6)' -1 'i' r 'substr(Titel,APOS+1)''
  568.        lister select handle '"'right(i+1,3," ")'.'substr(SONG.i,CPOS+9)'"' on
  569.     end
  570. lister refresh handle
  571. return
  572.  
  573. /*-------Read All-------------------------------------------------------------------------*/
  574. READALL:
  575. lister query oldsource path
  576. droppfad=result
  577. pos1=2
  578.     do forever
  579.         pos2=pos('"',DATA,pos1+1)
  580.         if pos2=0 then leave
  581.            addname=substr(DATA,pos1,pos2-pos1)
  582.         pos1=pos2+3
  583.         lister query oldsource entry '"'addname'"' stem fileinfo.
  584.         if fileinfo.type >0 then do
  585.             lister new toolbar DUMMY droppfad||fileinfo.name
  586.             source=result
  587.             lister wait source
  588.             if READSOURCE(1)=5 then do
  589.                 lister set oldsource busy off
  590.                 return 5
  591.                 end
  592.                lister select oldsource '"'addname'"' off
  593.             lister refresh oldsource full
  594.             end
  595.             else do
  596.             source=oldsource
  597.             if READSOURCE(0)=5 then do
  598.                 lister set oldsource busy off
  599.                 return 5
  600.                 end
  601.             lister query oldsource numseldirs
  602.             if result=0 then leave
  603.         end
  604.     end
  605. lister set oldsource busy off
  606. return 0
  607.  
  608. /*-------Read Source-----------------------------------------------------------------------*/
  609. READSOURCE:
  610. parse arg Arg1
  611. address value portname
  612. lister set source busy on
  613. lister query source path
  614. QuellPfad=result
  615. if Arg1=1 then lister query source files stem files.
  616.     else lister query source selfiles stem files.
  617. lister set source newprogress name file bar abort
  618. lister set source newprogress title getcatstr(4,'Scanning files ...')
  619. lister refresh source full
  620. do i=0 to files.count-1
  621.        lister query source abort
  622.        if result then do
  623.         lister refresh source full
  624.         lister set source busy off
  625.         if Arg1=1 then lister close source
  626.         k=l
  627.         return 5
  628.         end
  629.     lister set source newprogress bar files.count i+1
  630.        lister set source newprogress name files.i
  631.     lister set source newprogress file files.count i+1
  632.        lister select source '"'files.i'"' off
  633.     lister refresh source full
  634.     Titel=Quellpfad||files.i
  635.        dopus getfiletype '"'Titel'"' id
  636.     if result="MP2"|result="MP3" then do
  637.               lister query source entry '"'files.i'"' stem fileinfo.
  638.               SONG.k=Titel' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment
  639.         k=k+1
  640.           end
  641. end
  642. lister set source busy off
  643. if Arg1=1 then lister close source
  644. return 0
  645.  
  646. /*-------Locale-------------------------------------------------------------------------*/
  647. getcatstr:
  648.    parse arg msgno,msgstring,insert.1,insert.2
  649.    if catalog~=0 then msgstring=getcatalogstr(catalog,msgno,msgstring)
  650.    CNT=0
  651.    do while pos('%s',msgstring)>0
  652.       parse var msgstring fore '%s' aft
  653.       CNT=CNT+1
  654.       msgstring=fore||insert.CNT||aft
  655.       end
  656.    return msgstring
  657. /*---------------------------------------------------------------*/
  658. syntax:
  659. if rc=13 then call Ende  /* Melody MPEGPlay oder PeggyPlayer wurde über GUI beendet */
  660. say 'Syntax Error' rc',' errortext(rc) 'in line' sigl'.'
  661. return
  662.